home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.pro;
-
- import java.io.EOFException;
- import java.io.IOException;
- import java.io.InputStream;
- import java.util.Hashtable;
- import java.util.Properties;
- import java.util.Vector;
- import symantec.itools.db.net.Entity;
- import symantec.itools.db.net.NetData;
- import symantec.itools.db.net.NetRecord;
- import symantec.itools.db.net.NetString;
- import symantec.itools.db.net.RemoteObject;
- import symantec.itools.db.net.SQLConnectionException;
- import symantec.itools.db.net.TextParam;
- import symjava.lang.Bignum;
- import symjava.sql.Date;
- import symjava.sql.SQLException;
- import symjava.sql.Time;
- import symjava.sql.Timestamp;
-
- public class RelationView implements DataAccess {
- private RemoteObject _messgr;
- private Session _session;
- private MultiView _mv;
- private RelationView _parRV;
- private RelationViewMetaData _metadata;
- private int _proxyID;
- private RecordSet _block;
- private Record _rec;
- private Hashtable _colNames;
- private int _curRecNum;
- private int _numRowsToRequest;
- private Vector _binds;
- private Vector _recordBinds;
- private Vector _detailRVs;
- private byte _rvID;
- private String _name;
- private ConnectionInfo _conn;
- private boolean _notifyEnabled;
- private boolean _enableDetailSQL;
- private final int METHOD_getPreparedRelView;
- private final int METHOD_setName;
- private final int METHOD_filter;
- private final int METHOD_clearFilter;
- private final int METHOD_getListProxy;
- public static final int DEFAULTSCALE = 0;
- public static final int SETBLANKTODEFAULT = 0;
- public static final int SETBLANKTONULL = 1;
- public static final int SETBLANKTOEMPTY = 2;
-
- public RelationView(Request request) throws SQLException {
- this(request.getSession(), request.getConnectionInfo(), request.getSQL(), request);
- }
-
- public RelationView(AutoDetail detail) throws SQLException {
- this._notifyEnabled = true;
- this._enableDetailSQL = true;
- this.METHOD_getPreparedRelView = 1;
- this.METHOD_setName = 3;
- this.METHOD_filter = 4;
- this.METHOD_clearFilter = 5;
- this.METHOD_getListProxy = 6;
- Vector results = detail.getExecuteRequestResults();
- RelationView rv = detail.getRelationView();
- MultiView mv = rv.getMultiView();
- this.init(rv.getSession(), mv, rv, results, mv.getNextLevelID(), ((Request)detail).getConnectionInfo());
- rv.addDetailRelView(this);
- if (((Request)detail).getInitialRecordPos().equals(Request.REC_POS_FIRST)) {
- this.first();
- } else {
- if (((Request)detail).getInitialRecordPos().equals(Request.REC_POS_NEW)) {
- this.getNewRecord();
- }
-
- }
- }
-
- RelationView(Session session, ConnectionInfo conn, String sql, Properties requestProps) throws SQLException {
- this._notifyEnabled = true;
- this._enableDetailSQL = true;
- this.METHOD_getPreparedRelView = 1;
- this.METHOD_setName = 3;
- this.METHOD_filter = 4;
- this.METHOD_clearFilter = 5;
- this.METHOD_getListProxy = 6;
- Hashtable ht = convertViewProps(requestProps);
- MultiView mv = session.createMultiView(conn, sql, ht);
- Properties ctorProperties = mv.getRootRVCtorProperties();
- Vector ctorParams = (Vector)((Hashtable)ctorProperties).get("ctorParams");
- byte rvID = mv.getNextLevelID();
- this.init(session, mv, (RelationView)null, ctorParams, rvID, conn);
- mv.setRootRelView(this);
- this.setInitialPosition(requestProps);
- }
-
- RelationView(MultiView mv, byte rvID, ConnectionInfo conn) throws SQLException {
- this._notifyEnabled = true;
- this._enableDetailSQL = true;
- this.METHOD_getPreparedRelView = 1;
- this.METHOD_setName = 3;
- this.METHOD_filter = 4;
- this.METHOD_clearFilter = 5;
- this.METHOD_getListProxy = 6;
- Properties ctorProperties = mv.getRootRVCtorProperties();
- Session session = (Session)((Hashtable)ctorProperties).get("session");
- Vector ctorParams = (Vector)((Hashtable)ctorProperties).get("ctorParams");
- this.init(session, mv, (RelationView)null, ctorParams, rvID, conn);
- }
-
- void setInitialPosition(Properties requestProps) throws SQLException {
- Hashtable ht = convertViewProps(requestProps);
- String recPos = (String)ht.get("recPosition");
- if (recPos.equals(Request.REC_POS_FIRST)) {
- this.first();
- } else {
- if (recPos.equals(Request.REC_POS_NEW)) {
- this.getNewRecord();
- }
-
- }
- }
-
- static Hashtable convertViewProps(Properties viewProps) {
- Hashtable ht = new Hashtable();
- ht.put("user", viewProps.getProperty("user", ""));
- ht.put("password", viewProps.getProperty("password", ""));
- String value = viewProps.getProperty("optConc", Request.UNIQUE_MODIFIED);
- ht.put("optConc", Integer.valueOf(value));
- value = viewProps.getProperty("recPosition", Request.REC_POS_NOPOS);
- ht.put("recPosition", new String(value));
- value = viewProps.getProperty("maxRecords", "200");
- ht.put("maxRecords", Integer.valueOf(value));
- value = viewProps.getProperty("readOnly", "true");
- ht.put("readOnly", Boolean.valueOf(value));
- value = viewProps.getProperty("sharable", "true");
- ht.put("sharable", Boolean.valueOf(value));
- return ht;
- }
-
- RelationView(Session session, MultiView mv, RelationView parRV, Vector ctorParams, byte rvID, ConnectionInfo conn) throws SQLException {
- this._notifyEnabled = true;
- this._enableDetailSQL = true;
- this.METHOD_getPreparedRelView = 1;
- this.METHOD_setName = 3;
- this.METHOD_filter = 4;
- this.METHOD_clearFilter = 5;
- this.METHOD_getListProxy = 6;
- this.init(session, mv, parRV, ctorParams, rvID, conn);
- }
-
- Session getSession() {
- return this._session;
- }
-
- ConnectionInfo getConn() {
- return this._conn;
- }
-
- void init(Session session, MultiView mv, RelationView parRV, Vector ctorParams, byte rvID, ConnectionInfo conn) throws SQLException {
- this._parRV = parRV;
- this._rvID = rvID;
- this._curRecNum = 0;
- this._conn = conn;
- this._block = null;
- this._rec = null;
- this._mv = mv;
- this._session = session;
- this._detailRVs = new Vector();
- NetData d = (NetData)ctorParams.elementAt(0);
-
- int id;
- try {
- id = d.getInt();
- } catch (EOFException e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
-
- this._proxyID = id;
- this._messgr = new RemoteObject("CSCLRelView", id, session.getClientSession());
- NetString s = (NetString)ctorParams.elementAt(1);
- this._name = s.getString();
- Entity e = (Entity)ctorParams.elementAt(2);
- this._metadata = new RelationViewMetaData(this, e);
- Vector cols = this._metadata.getColumnList();
- this.initHashTableAndBinds(cols);
- int colCount = this._metadata.getColumnCount();
- if (colCount > 0) {
- int rowsize = 0;
-
- for(int i = 1; i <= colCount; ++i) {
- rowsize += this._metadata.getColumnDisplaySize(i) + 20;
- }
-
- this._numRowsToRequest = 4096 / rowsize;
- }
-
- if (this._numRowsToRequest == 0) {
- this._numRowsToRequest = 1;
- }
-
- this._rec = new Record(new NetRecord(), this._colNames, this, (RecordSet)null);
- }
-
- private void initHashTableAndBinds(Vector cols) {
- this._colNames = new Hashtable();
- this._binds = new Vector();
-
- for(int i = 0; i < cols.size(); ++i) {
- String s = (String)cols.elementAt(i);
- Integer colnum = new Integer(i + 1);
- this._colNames.put(s, colnum);
- this._colNames.put(colnum.toString(), colnum);
- this._binds.addElement(new ProjBinder(i + 1, this, this._notifyEnabled));
- }
-
- this._recordBinds = new Vector();
- }
-
- private void closeStream() {
- if (this._rec != null) {
- this._rec.closeStream();
- }
-
- }
-
- int getColIndex(String colName) throws SQLException {
- Integer i = (Integer)this._colNames.get(colName);
- if (i != null) {
- return i;
- } else {
- throw new SQLException("Column not found.");
- }
- }
-
- private boolean isRecValid(Record r) {
- return r != null && r.getState() != 105;
- }
-
- private boolean isRecValid(NetRecord r) {
- return r != null && r.getState() != 105;
- }
-
- private ProjBinder getBind(int id) {
- return (ProjBinder)this._binds.elementAt(id - 1);
- }
-
- private RecordLink getRecordBind(int id) {
- return (RecordLink)this._recordBinds.elementAt(id);
- }
-
- void addDetailRelView(RelationView rv) {
- this._detailRVs.addElement(rv);
- }
-
- void notifyDataChange(int projID, Record rec) {
- if (rec == this._rec) {
- ProjBinder d = this.getBind(projID);
- d.notifyDataChange();
- }
-
- }
-
- void notifyRowStateChange() throws SQLException {
- if (this._notifyEnabled) {
- for(int i = 0; i < this._recordBinds.size(); ++i) {
- this.getRecordBind(i).notifyRecordChange(this._rec);
- }
- }
-
- }
-
- void notifyRowChange() throws SQLException {
- if (this._notifyEnabled) {
- for(int i = 0; i < this._recordBinds.size(); ++i) {
- this.getRecordBind(i).notifyRecordChange(this._rec);
- }
- }
-
- for(int i = 1; i <= this._binds.size(); ++i) {
- this.getBind(i).notifyDataChange();
- }
-
- }
-
- boolean notifySetData() throws SQLException {
- if (this.isRecValid(this._rec)) {
- for(int i = 1; i <= this._binds.size(); ++i) {
- ProjBinder d = this.getBind(i);
- if (!d.notifySetData()) {
- return false;
- }
- }
-
- for(int i = 0; i < this._detailRVs.size(); ++i) {
- RelationView rv = (RelationView)this._detailRVs.elementAt(i);
- if (!rv.notifySetData()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- RecordSet getRecordSet() throws SQLException {
- if (this._block != null) {
- return this._block;
- } else {
- RelViewPos pos = new RelViewPos(this.getMultiView());
- pos.addParentInfo(new RelViewInfo(this._rvID, 0, this._proxyID, this._numRowsToRequest));
- return this._parRV != null ? this._parRV.getChildRecordSet(pos) : this.getMultiView().getRecordSet(pos);
- }
- }
-
- RecordSet getChildRecordSet(RelViewPos pos) throws SQLException {
- if (this.getCurrentRecordState() != 103 && this.getCurrentRecordState() != 104 && this._enableDetailSQL && this._curRecNum != 0) {
- pos.addParentInfo(new RelViewInfo(this._rvID, this._curRecNum, this._proxyID, this._numRowsToRequest));
- return this._parRV != null ? this._parRV.getChildRecordSet(pos) : this.getMultiView().getRecordSet(pos);
- } else {
- return null;
- }
- }
-
- void rewindDetailRelViews() throws SQLException {
- for(int i = 0; i < this._detailRVs.size(); ++i) {
- RelationView rv = (RelationView)this._detailRVs.elementAt(i);
- rv.rewind();
- }
-
- }
-
- void resetDetailRelViews(boolean bClose) throws SQLException {
- for(int i = 0; i < this._detailRVs.size(); ++i) {
- RelationView rv = (RelationView)this._detailRVs.elementAt(i);
- rv.resetRecordSet(bClose);
- }
-
- }
-
- void resetRecordSet(boolean bClose) throws SQLException {
- this.closeStream();
- this._block = null;
- this._curRecNum = 0;
- this._rec = new Record(new NetRecord(), this._colNames, this, (RecordSet)null);
- if (bClose) {
- this.resetDetailRelViews(bClose);
- this._messgr.disable();
- } else if (this.bindsExist()) {
- this.goTo(1);
- } else {
- this.notifyRowChange();
- this.resetDetailRelViews(bClose);
- }
- }
-
- boolean bindsExist() {
- for(int i = 1; i <= this._binds.size(); ++i) {
- if (this.getBind(i).bindsExist()) {
- return true;
- }
- }
-
- return false;
- }
-
- public void enableDetailSQL(boolean enable) throws SQLException {
- if (this._enableDetailSQL != enable) {
- this._enableDetailSQL = enable;
- this.resetDetailRelViews(false);
- }
- }
-
- public void enableBindingNotify(boolean enable, boolean applyToDetails) throws SQLException {
- this._notifyEnabled = enable;
-
- for(int i = 1; i <= this._binds.size(); ++i) {
- this.getBind(i).enable(enable);
- }
-
- if (applyToDetails) {
- for(int i = 0; i < this._detailRVs.size(); ++i) {
- RelationView rv = (RelationView)this._detailRVs.elementAt(i);
- rv.enableBindingNotify(enable, applyToDetails);
- }
- }
-
- }
-
- public void enableBindingNotify(boolean enable) throws SQLException {
- this.enableBindingNotify(enable, true);
- }
-
- public boolean isBindingNotifyEnabled() throws SQLException {
- return this._notifyEnabled;
- }
-
- public void bindCurrentRecord(RecordLink obj) throws SQLException {
- obj.init();
- if (this._notifyEnabled) {
- obj.notifyRecordChange(this._rec);
- }
-
- this._recordBinds.addElement(obj);
- }
-
- public ListBinder bindList(ConnectionInfo conn, String sql, ListLink listObj, Vector columns) throws SQLException {
- int retries = 0;
-
- while(true) {
- String username = conn.getUser();
- String password = conn.getPassword();
- String db = conn.getDBString();
- Vector params = new Vector();
- params.addElement(new TextParam(0, db));
- params.addElement(new TextParam(0, username));
- params.addElement(new TextParam(0, password));
- params.addElement(new TextParam(0, sql));
-
- try {
- Vector results = this._messgr.invokeMethod(6, params);
- NetData d = (NetData)results.elementAt(0);
- return new ListBinder(this, d.getInt(), columns, listObj, this._session, conn);
- } catch (EOFException e) {
- throw new SQLException(((Throwable)e).getMessage());
- } catch (SQLConnectionException e) {
- ++retries;
- if (!this._session.logonFailed(conn, retries)) {
- throw e;
- }
- }
- }
- }
-
- public ListBinder bindList(ConnectionInfo conn, String sql, ListLink listObj, int[] columns) throws SQLException {
- Vector ids = new Vector();
-
- for(int i = 0; i < columns.length; ++i) {
- ids.addElement(new Integer(columns[i]));
- }
-
- return this.bindList(conn, sql, listObj, ids);
- }
-
- public ProjBinder bindProj(int proj, ProjLink obj) throws SQLException {
- ProjBinder d = this.getBind(proj);
- d.addLink(obj);
- obj.init(d);
- if (this.getCurrentRecordState() != 105) {
- this.notifyDataChange(proj, this._rec);
- } else {
- this.goTo(1);
- }
-
- return d;
- }
-
- public void closeMultiView() throws SQLException {
- this._mv.close();
- }
-
- public void deleteRecord() throws SQLException {
- this._rec.delete();
- }
-
- public boolean doesProjExist(String name) throws SQLException {
- return this._colNames.containsKey(name);
- }
-
- public int findProjByName(String name) throws SQLException {
- return this.getColIndex(name);
- }
-
- public boolean first() throws SQLException {
- return this.goTo(1);
- }
-
- public int getCurrentRecordNumber() {
- return this._curRecNum;
- }
-
- public String getCurrentRecordNumberString() {
- return String.valueOf(this._curRecNum);
- }
-
- public byte getCurrentRecordState() {
- return this._rec == null ? 105 : this._rec.getState();
- }
-
- public boolean isCurrentRecordWritable() throws SQLException {
- return this._rec.isWritable();
- }
-
- public boolean isCurrentRecordReadable() throws SQLException {
- return this._rec.isReadable();
- }
-
- public RelationViewMetaData getMetaData() throws SQLException {
- return this._metadata;
- }
-
- public MultiView getMultiView() throws SQLException {
- return this._mv;
- }
-
- public String getName() throws SQLException {
- return this._name;
- }
-
- public boolean getNewRecord() throws SQLException {
- if (!this.notifySetData()) {
- return false;
- } else {
- this.closeStream();
- RecordSet block = this.getRecordSet();
- if (block == null) {
- this._curRecNum = 0;
- this._rec = new Record(new NetRecord(), this._colNames, this, (RecordSet)null);
- this.notifyRowChange();
- this.resetDetailRelViews(false);
- return false;
- } else {
- NetRecord r = block.getNewRecord();
- boolean newRecValid = this.isRecValid(r);
- if (newRecValid) {
- this._curRecNum = r.getRecordNum();
- this._rec = new Record(r, this._colNames, this, block);
- this.notifyRowChange();
- this.resetDetailRelViews(false);
- }
-
- return newRecValid;
- }
- }
- }
-
- public Record getRecord() throws SQLException {
- return this._rec;
- }
-
- public void rewind() throws SQLException {
- if (this.notifySetData()) {
- this.closeStream();
- this._block = null;
- this._curRecNum = 0;
- this._rec = new Record(new NetRecord(), this._colNames, this, (RecordSet)null);
- this.notifyRowChange();
- this.rewindDetailRelViews();
- }
- }
-
- public boolean goTo(int RecordNum) throws SQLException {
- if (!this.notifySetData()) {
- return false;
- } else {
- this.closeStream();
- RecordSet block = this.getRecordSet();
- if (block == null) {
- this._curRecNum = 0;
- this._rec = new Record(new NetRecord(), this._colNames, this, (RecordSet)null);
- this.notifyRowChange();
- this.resetDetailRelViews(false);
- return false;
- } else {
- NetRecord r = block.getRecord(RecordNum);
- boolean newRecValid = this.isRecValid(r);
- if (newRecValid) {
- this._curRecNum = RecordNum;
- this._rec = new Record(r, this._colNames, this, block);
- this.notifyRowChange();
- this.resetDetailRelViews(false);
- }
-
- if (!newRecValid && this._curRecNum == 0) {
- this.notifyRowChange();
- }
-
- return newRecValid;
- }
- }
- }
-
- public boolean goTo(String RecordNum) throws SQLException {
- Integer iNum = Integer.valueOf(RecordNum);
- return this.goTo(iNum);
- }
-
- public boolean next() throws SQLException {
- return this.goTo(this._curRecNum + 1);
- }
-
- public AutoDetail getAutoDetail(ConnectionInfo conn, String sql, Properties requestProps, Properties detailProps) throws SQLException {
- AutoDetail autoDetail = new AutoDetail(this, conn);
- ((Request)autoDetail).setSQL(sql);
- ((Request)autoDetail).setRequestProperties(requestProps);
- autoDetail.setDetailProperties(detailProps);
- return autoDetail;
- }
-
- int getAutoDetailMessgrID(ConnectionInfo conn, String sql, Properties requestProps, Properties detailProps) throws SQLException {
- Vector results = this._messgr.invokeMethod(1, "RelView");
- NetData d = (NetData)results.elementAt(0);
-
- try {
- int id = d.getInt();
- return id;
- } catch (EOFException e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public AutoDetail getAutoDetail() throws SQLException {
- return this.getAutoDetail("");
- }
-
- int getAutoDetailMessgrID() throws SQLException {
- return this.getAutoDetailMessgrID("");
- }
-
- public AutoDetail getAutoDetail(String sql) throws SQLException {
- return this.getAutoDetail(this._conn, sql, new Properties(), new Properties());
- }
-
- int getAutoDetailMessgrID(String sql) throws SQLException {
- return this.getAutoDetailMessgrID(this._conn, sql, new Properties(), new Properties());
- }
-
- public boolean prev() throws SQLException {
- return this._curRecNum == 0 ? false : this.goTo(this._curRecNum - 1);
- }
-
- public void saveMultiView() throws SQLException {
- this._mv.save();
- }
-
- public void restartMultiView() throws SQLException {
- this._mv.restart();
- }
-
- public void setName(String newName) throws SQLException {
- this._messgr.invokeMethod(3, newName);
- this._name = newName;
- }
-
- public void unBindObj(Object obj) throws SQLException {
- for(int i = 1; i <= this._binds.size(); ++i) {
- this.getBind(i).removeLink(obj);
- }
-
- }
-
- public void unBindProj(int proj) throws SQLException {
- this.getBind(proj).removeAllLinks();
- }
-
- public void undoRecord() throws SQLException {
- this._rec.undo();
- this.notifyRowChange();
- }
-
- public boolean isNull(int proj) throws SQLException {
- return this._rec.isNull(proj);
- }
-
- public String getString(int proj) throws SQLException {
- return this._rec.getString(proj);
- }
-
- public boolean getBoolean(int proj) throws SQLException {
- return this._rec.getBoolean(proj);
- }
-
- public byte getByte(int proj) throws SQLException {
- return this._rec.getByte(proj);
- }
-
- public short getShort(int proj) throws SQLException {
- return this._rec.getShort(proj);
- }
-
- public int getInt(int proj) throws SQLException {
- return this._rec.getInt(proj);
- }
-
- public long getLong(int proj) throws SQLException {
- return this._rec.getLong(proj);
- }
-
- public float getFloat(int proj) throws SQLException {
- return this._rec.getFloat(proj);
- }
-
- public double getDouble(int proj) throws SQLException {
- return this._rec.getDouble(proj);
- }
-
- public Bignum getBignum(int proj, int scale) throws SQLException {
- return this._rec.getBignum(proj, scale);
- }
-
- public byte[] getBytes(int proj) throws SQLException {
- return this._rec.getBytes(proj);
- }
-
- public Date getDate(int proj) throws SQLException {
- return this._rec.getDate(proj);
- }
-
- public Time getTime(int proj) throws SQLException {
- return this._rec.getTime(proj);
- }
-
- public Timestamp getTimestamp(int proj) throws SQLException {
- return this._rec.getTimestamp(proj);
- }
-
- public InputStream getAsciiStream(int proj) throws SQLException {
- return this._rec.getAsciiStream(proj);
- }
-
- public InputStream getUnicodeStream(int proj) throws SQLException {
- return this._rec.getUnicodeStream(proj);
- }
-
- public InputStream getBinaryStream(int proj) throws SQLException {
- return this._rec.getBinaryStream(proj);
- }
-
- public String getStringValue(int proj, int scale) throws SQLException, IOException {
- return this._rec.getStringValue(proj, scale);
- }
-
- public String getStringValue(int proj, int scale, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(proj, scale);
- }
-
- public String getStringValue(int proj) throws SQLException, IOException {
- return this._rec.getStringValue(proj);
- }
-
- public String getStringValue(int proj, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(proj, processBinaryData);
- }
-
- public String getStringValue(int proj, String columnTypeName, int scale) throws SQLException, IOException {
- return this._rec.getStringValue(proj, columnTypeName, scale);
- }
-
- public String getStringValue(int proj, String columnTypeName, int scale, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(proj, columnTypeName, scale, processBinaryData);
- }
-
- public String getStringValue(int proj, int columnType, int scale) throws SQLException, IOException {
- return this._rec.getStringValue(proj, columnType, scale);
- }
-
- public String getStringValue(int proj, int columnType, int scale, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(proj, columnType, scale, processBinaryData);
- }
-
- public boolean isNull(String projName) throws SQLException {
- return this._rec.isNull(projName);
- }
-
- public String getString(String projName) throws SQLException {
- return this._rec.getString(projName);
- }
-
- public boolean getBoolean(String projName) throws SQLException {
- return this._rec.getBoolean(projName);
- }
-
- public byte getByte(String projName) throws SQLException {
- return this._rec.getByte(projName);
- }
-
- public short getShort(String projName) throws SQLException {
- return this._rec.getShort(projName);
- }
-
- public int getInt(String projName) throws SQLException {
- return this._rec.getInt(projName);
- }
-
- public long getLong(String projName) throws SQLException {
- return this._rec.getLong(projName);
- }
-
- public float getFloat(String projName) throws SQLException {
- return this._rec.getFloat(projName);
- }
-
- public double getDouble(String projName) throws SQLException {
- return this._rec.getDouble(projName);
- }
-
- public Bignum getBignum(String projName, int scale) throws SQLException {
- return this._rec.getBignum(projName, scale);
- }
-
- public byte[] getBytes(String projName) throws SQLException {
- return this._rec.getBytes(projName);
- }
-
- public Date getDate(String projName) throws SQLException {
- return this._rec.getDate(projName);
- }
-
- public Time getTime(String projName) throws SQLException {
- return this._rec.getTime(projName);
- }
-
- public Timestamp getTimestamp(String projName) throws SQLException {
- return this._rec.getTimestamp(projName);
- }
-
- public InputStream getAsciiStream(String projName) throws SQLException {
- return this._rec.getAsciiStream(projName);
- }
-
- public InputStream getUnicodeStream(String projName) throws SQLException {
- return this._rec.getUnicodeStream(projName);
- }
-
- public InputStream getBinaryStream(String projName) throws SQLException {
- return this._rec.getBinaryStream(projName);
- }
-
- public String getStringValue(String projName, int scale) throws SQLException, IOException {
- return this._rec.getStringValue(projName, scale);
- }
-
- public String getStringValue(String projName, int scale, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(projName, scale, processBinaryData);
- }
-
- public String getStringValue(String projName) throws SQLException, IOException {
- return this._rec.getStringValue(projName);
- }
-
- public String getStringValue(String projName, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(projName, processBinaryData);
- }
-
- public String getStringValue(String projName, String columnTypeName, int scale) throws SQLException, IOException {
- return this._rec.getStringValue(projName, columnTypeName, scale);
- }
-
- public String getStringValue(String projName, String columnTypeName, int scale, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(projName, columnTypeName, scale, processBinaryData);
- }
-
- public String getStringValue(String projName, int columnType, int scale) throws SQLException, IOException {
- return this._rec.getStringValue(projName, columnType, scale);
- }
-
- public String getStringValue(String projName, int columnType, int scale, boolean processBinaryData) throws SQLException, IOException {
- return this._rec.getStringValue(projName, columnType, scale, processBinaryData);
- }
-
- public void setNull(int proj, int sqlType) throws SQLException {
- this._rec.setNull(proj, sqlType);
- }
-
- public void setBoolean(int proj, boolean x) throws SQLException {
- this._rec.setBoolean(proj, x);
- }
-
- public void setByte(int proj, byte x) throws SQLException {
- this._rec.setByte(proj, x);
- }
-
- public void setShort(int proj, short x) throws SQLException {
- this._rec.setShort(proj, x);
- }
-
- public void setInt(int proj, int x) throws SQLException {
- this._rec.setInt(proj, x);
- }
-
- public void setLong(int proj, long x) throws SQLException {
- this._rec.setLong(proj, x);
- }
-
- public void setFloat(int proj, float x) throws SQLException {
- this._rec.setFloat(proj, x);
- }
-
- public void setDouble(int proj, double x) throws SQLException {
- this._rec.setDouble(proj, x);
- }
-
- public void setBignum(int proj, Bignum x) throws SQLException {
- this._rec.setBignum(proj, x);
- }
-
- public void setString(int proj, String x) throws SQLException {
- this._rec.setString(proj, x);
- }
-
- public void setBytes(int proj, byte[] x) throws SQLException {
- this._rec.setBytes(proj, x);
- }
-
- public void setDate(int proj, Date x) throws SQLException {
- this._rec.setDate(proj, x);
- }
-
- public void setTime(int proj, Time x) throws SQLException {
- this._rec.setTime(proj, x);
- }
-
- public void setTimestamp(int proj, Timestamp x) throws SQLException {
- this._rec.setTimestamp(proj, x);
- }
-
- public void setAsciiStream(int proj, InputStream x, int length) throws SQLException {
- this._rec.setAsciiStream(proj, x, length);
- }
-
- public void setUnicodeStream(int proj, InputStream x, int length) throws SQLException {
- this._rec.setUnicodeStream(proj, x, length);
- }
-
- public void setBinaryStream(int proj, InputStream x, int length) throws SQLException {
- this._rec.setBinaryStream(proj, x, length);
- }
-
- public void setValueFromString(int proj, String data, int scale, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(proj, data, scale, treatBlankAsNull);
- }
-
- public void setValueFromString(int proj, String data) throws SQLException, IOException {
- this._rec.setValueFromString(proj, data);
- }
-
- public void setValueFromString(int proj, String data, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(proj, data, treatBlankAsNull);
- }
-
- public void setValueFromString(int proj, String data, String columnTypeName, int scale) throws SQLException, IOException {
- this._rec.setValueFromString(proj, data, columnTypeName, scale);
- }
-
- public void setValueFromString(int proj, String data, String columnTypeName, int scale, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(proj, data, columnTypeName, scale, treatBlankAsNull);
- }
-
- public void setValueFromString(int proj, String data, int columnType, int scale, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(proj, data, columnType, scale, treatBlankAsNull);
- }
-
- public void setNull(String projName, int sqlType) throws SQLException {
- this._rec.setNull(projName, sqlType);
- }
-
- public void setBoolean(String projName, boolean x) throws SQLException {
- this._rec.setBoolean(projName, x);
- }
-
- public void setByte(String projName, byte x) throws SQLException {
- this._rec.setByte(projName, x);
- }
-
- public void setShort(String projName, short x) throws SQLException {
- this._rec.setShort(projName, x);
- }
-
- public void setInt(String projName, int x) throws SQLException {
- this._rec.setInt(projName, x);
- }
-
- public void setLong(String projName, long x) throws SQLException {
- this._rec.setLong(projName, x);
- }
-
- public void setFloat(String projName, float x) throws SQLException {
- this._rec.setFloat(projName, x);
- }
-
- public void setDouble(String projName, double x) throws SQLException {
- this._rec.setDouble(projName, x);
- }
-
- public void setBignum(String projName, Bignum x) throws SQLException {
- this._rec.setBignum(projName, x);
- }
-
- public void setString(String projName, String x) throws SQLException {
- this._rec.setString(projName, x);
- }
-
- public void setBytes(String projName, byte[] x) throws SQLException {
- this._rec.setBytes(projName, x);
- }
-
- public void setDate(String projName, Date x) throws SQLException {
- this._rec.setDate(projName, x);
- }
-
- public void setTime(String projName, Time x) throws SQLException {
- this._rec.setTime(projName, x);
- }
-
- public void setTimestamp(String projName, Timestamp x) throws SQLException {
- this._rec.setTimestamp(projName, x);
- }
-
- public void setAsciiStream(String projName, InputStream x, int length) throws SQLException {
- this._rec.setAsciiStream(projName, x, length);
- }
-
- public void setUnicodeStream(String projName, InputStream x, int length) throws SQLException {
- this._rec.setUnicodeStream(projName, x, length);
- }
-
- public void setBinaryStream(String projName, InputStream x, int length) throws SQLException {
- this._rec.setBinaryStream(projName, x, length);
- }
-
- public void setValueFromString(String projName, String data, int scale, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(projName, data, scale, treatBlankAsNull);
- }
-
- public void setValueFromString(String projName, String data) throws SQLException, IOException {
- this._rec.setValueFromString(projName, data);
- }
-
- public void setValueFromString(String projName, String data, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(projName, data, treatBlankAsNull);
- }
-
- public void setValueFromString(String projName, String data, String columnTypeName, int scale) throws SQLException, IOException {
- this._rec.setValueFromString(projName, data, columnTypeName, scale);
- }
-
- public void setValueFromString(String projName, String data, String columnTypeName, int scale, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(projName, data, columnTypeName, scale, treatBlankAsNull);
- }
-
- public void setValueFromString(String projName, String data, int columnType, int scale, int treatBlankAsNull) throws SQLException, IOException {
- this._rec.setValueFromString(projName, data, columnType, scale, treatBlankAsNull);
- }
-
- public static String asciiStreamtoString(InputStream is) throws IOException {
- String s;
- int i;
- for(s = ""; (i = is.read()) != -1; s = s + (char)i) {
- }
-
- return s;
- }
-
- public static String binaryArraytoString(byte[] b) throws IOException {
- String s = "";
- int count = Math.min(b.length, 255);
-
- for(int i = 0; i < count; ++i) {
- if (b[i] == 0) {
- s = s + "/0";
- } else {
- s = s + b[i];
- }
- }
-
- return s;
- }
-
- public static String binaryStreamtoString(InputStream is, int length) throws IOException {
- String s = "";
-
- int i;
- for(int count = length; (i = is.read()) != -1 && count-- > 0; s = s + "/" + i) {
- }
-
- return s;
- }
-
- public static int sqlTypeConvert(String typename) {
- if (typename.equals("Char")) {
- return 1;
- } else if (typename.equals("VarChar")) {
- return 12;
- } else if (typename.equals("LongVarChar")) {
- return -1;
- } else if (typename.equals("Bit")) {
- return -7;
- } else if (typename.equals("TinyInt")) {
- return -6;
- } else if (typename.equals("SmallInt")) {
- return 5;
- } else if (typename.equals("Integer")) {
- return 4;
- } else if (typename.equals("BigInt")) {
- return -5;
- } else if (typename.equals("Float")) {
- return 6;
- } else if (typename.equals("Real")) {
- return 7;
- } else if (typename.equals("Double")) {
- return 8;
- } else if (typename.equals("Numeric")) {
- return 2;
- } else if (typename.equals("Decimal")) {
- return 3;
- } else if (typename.equals("Date")) {
- return 91;
- } else if (typename.equals("Time")) {
- return 92;
- } else if (typename.equals("Timestamp")) {
- return 93;
- } else if (typename.equals("Binary")) {
- return -2;
- } else if (typename.equals("VarBinary")) {
- return -3;
- } else if (typename.equals("LongVarBinary")) {
- return -4;
- } else if (typename.equals("Other")) {
- return 1111;
- } else {
- return typename.equals("Null") ? 0 : 1111;
- }
- }
-
- public static String sqlTypeConvert(int typeid) {
- if (typeid == 1) {
- return "Char";
- } else if (typeid == 12) {
- return "VarChar";
- } else if (typeid == -1) {
- return "LongVarChar";
- } else if (typeid == -7) {
- return "Bit";
- } else if (typeid == -6) {
- return "TinyInt";
- } else if (typeid == 5) {
- return "SmallInt";
- } else if (typeid == 4) {
- return "Integer";
- } else if (typeid == -5) {
- return "BigInt";
- } else if (typeid == 6) {
- return "Float";
- } else if (typeid == 7) {
- return "Real";
- } else if (typeid == 8) {
- return "Double";
- } else if (typeid == 2) {
- return "Numeric";
- } else if (typeid == 3) {
- return "Decimal";
- } else if (typeid == 91) {
- return "Date";
- } else if (typeid == 92) {
- return "Time";
- } else if (typeid == 93) {
- return "Timestamp";
- } else if (typeid == -2) {
- return "Binary";
- } else if (typeid == -3) {
- return "VarBinary";
- } else if (typeid == -4) {
- return "LongVarBinary";
- } else if (typeid == 1111) {
- return "Other";
- } else {
- return typeid == 0 ? "Null" : "Other";
- }
- }
-
- public static String processEmptyStringData(String data, RelationView rv, int proj, int columnType, int treatBlankAsNull) throws SQLException {
- if (treatBlankAsNull == 0) {
- if (rv.isNull(proj) || columnType != 1 && columnType != 12 && columnType != -1) {
- data = null;
- } else {
- data = "";
- }
- } else if (treatBlankAsNull != 1 && columnType != -2 && columnType != -3 && columnType != -4 && columnType != 1111) {
- if (treatBlankAsNull == 2) {
- switch (columnType) {
- case -7:
- case -6:
- case -5:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- data = "0";
- break;
- case -1:
- case 1:
- case 12:
- data = "";
- break;
- case 91:
- data = "1970-01-01";
- break;
- case 92:
- data = "12:00:00";
- break;
- case 93:
- data = "1970-01-01 12:00:00.0";
- }
- }
- } else {
- data = null;
- }
-
- return data;
- }
-
- public RelationView getParentRelationView() {
- return this._parRV;
- }
- }
-